import React, {Component} from 'react'
import {goAction, cautionAction, stopAction} from './test2_action'

export const Buttons = ({store}) => {
    console.log(store)
    const state = store.getState();
    console.log(state)
    return (
        <div style={{textAlign: 'center'}}>
            <button onClick={() => {
                store.dispatch(goAction);

            }}
                    disabled={store.getState() == 'GO' || store.getState() == 'CAUTION'}
                    style={{cursor: 'pointer'}}>
                GO
            </button>
            <button onClick={() => {
                store.dispatch(cautionAction)
                console.log(store.getState())
            }}
                    disabled={store.getState() == 'CAUTION' || store.getState() == 'STOP'}
                    style={{cursor: 'pointer'}}>
                Caution
            </button>
            <button onClick={() => {
                store.dispatch(stopAction)
            }}
                    disabled={store.getState() == 'STOP' || store.getState() == 'GO'}
                    style={{cursor: 'pointer'}}>
                Stop
            </button>
        </div>
    )
}


